<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>

</body>
<script>
	// 原型链继承
	// - 缺点：父类当中提供的属性方法全部都来原型链。这些数据和方法对于实例而言是共享的。容易造成数据的混乱。
	const Box = function(){
		this.userName = "zhangsan";
	}
	Box.prototype.fn = function(){
		console.log(this.userName);
	}
	const Desk = function(){
	
	}
	Desk.prototype = new Box();
	Desk.prototype.constructor = Desk;
	const obj = new Desk();
	const obj2 = new Desk();
	console.log(obj.constructor === Box);
	obj2.__proto__.userName = "lisi";
	console.log(obj.userName);
	console.log(obj.__proto__ === Desk.prototype);// true
	console.log(Desk.prototype.__proto__ === Box.prototype);// true
	console.log(Box.prototype.__proto__ === Object.prototype);// true
	console.log(Object.prototype.__proto__);// null
</script>
</html>